package com.yzh.booksystem.dao;

import com.yzh.booksystem.entity.Book;
import com.yzh.booksystem.utils.Utils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

public class DeleteBookDao {
    QueryRunner queryRunner = new QueryRunner(Utils.getDataSource());

    public boolean deleteBook(Book book) throws SQLException {
        String sql = "delete from book where id = ?";
        int num = queryRunner.update(sql, book.getId());
        if (num > 0) {
            return true;
        } else {
            return false;
        }
    }
}
